
<%@page import="com.ignou.mca.datasource.DataBaseUtilities"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="com.ignou.mca.beans.UserVO"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5;url=AdminMenu.jsp">
<title>Delete Voter</title>
<link rel="stylesheet" href="theme/Master.css" type="text/css">
<head>
<body>
<%
	UserVO userVoObj = (UserVO) session.getAttribute("UserVO");
	if (userVoObj == null) {
		response.sendRedirect(request.getContextPath() + "/Home.htm");
	}
%>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="21" bgcolor="#495e83"></td>
    <td height="21" bgcolor="#495e83"></td>
  </tr>
  <tr>
    <td height="119" align="left" valign="middle" bgcolor="#FFFFFF"> <img alt="" src="././images/company_logo.JPG" width="304" height="53">
    </td>
    <td align="right" width="287"><img alt="" src="images/header_graphic.jpg" width="287" height="119"></td>
  </tr>
  <tr>
	<td height="45" valign="middle" bgcolor="#495e83"> &nbsp; &nbsp; &nbsp; <a href="AdminMenu.jsp" class="links" target="" >Main Menu</a>
      &nbsp; &nbsp; &nbsp; &nbsp; <a href="Logout.jsp" class="links" target="">Logout</a></td>

     <td bgcolor="#495e83"></td>
  </tr>
  <tr>
    <td height="1"><img alt="" src="images/spacer.gif" width="1" height="1"></td>
    <td height="1"><img alt="" src="images/spacer.gif" width="1" height="1"></td>
  </tr>
  <tr background="images/links_bot_fill.gif">
    <td height="30">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="5" bgcolor="#FFFFFF">
  <tr>
    <td bgcolor="#FFFFFF" width="20"><img alt="" src="images/spacer.gif" width="20" height="10"></td>
    <td bgcolor="#FFFFFF" align="left" valign="top" class="text" height="309" width="99%"><br>
      <!-- #BeginEditable "content" -->
      <%
	     DataBaseUtilities dbu = new DataBaseUtilities();
	     try{
	    	 String userName = request.getParameter("userID");
		     Connection conn = dbu.getConnection();
		     if(userName != null && !userName.equals(""))
		     {
		    	 String query = "delete from users where userName=?";
			     PreparedStatement pst = conn.prepareStatement(query);
				 pst.setString(1, userName);
					
				 int i = pst.executeUpdate();
					out.println(i + "");
				 out.println("<center><font color='green' size='3'> Voter Deleted Successfully</font></center>");	
				 conn.close();
		     }
		     else
		     {
		    	 out.println("<center><font color='red' size='3'> Unable to delete Voter</font></center>");	
		     }
		    
	     }catch(Exception e)
	     {
	    	 out.println("<center><font color='red' size='3'> Unable to delete Voter</font></center>");	
	     }
	    
      %>
<br><br>
<br><br>

    <td bgcolor="#FFFFFF" width="20"><img alt="" src="images/spacer.gif" width="20" height="10"></td>
  </tr>
  <tr>
    <td bgcolor="#495e83" width="20">&nbsp;</td>
    <td height="35" align="center" valign="middle" bgcolor="#495e83" class="footer">Copyright
      &copy; 2011 All Rights Reserved. Designed by Pradeepthi S</td>
    <td bgcolor="#495e83" width="20">&nbsp;</td>

  </tr>

</table>
</body>
</html>